// Copyright (c) 2019 Graphcore Ltd. All rights reserved.
#ifndef GFLOAT_CONST_H
#define GFLOAT_CONST_H

#ifdef __IPU__
#include "poplar/AvailableVTypes.h"
#endif

#undef POPFLOAT_ENABLE_IPU_VECTORISED_OP
#undef POPFLOAT_INITIALISE_VECTORS_FROM_INT
#undef POPFLOAT_STORE_HALF_AS_SHORT

/*!
  VERTICES
 */

#define POPFLOAT_VERTEX_CALC_PACKED_GF_PARAM_STRUCT 0
#define POPFLOAT_VERTEX_CALC_PACKED_GF_PARAM_MAN_BITS 1
#define POPFLOAT_VERTEX_CALC_PACKED_GF_PARAM_EXP_BITS 2
#define POPFLOAT_VERTEX_CALC_PACKED_GF_PARAM_EXP_BIAS 3
#define POPFLOAT_VERTEX_CALC_PACKED_GF_PARAM_EN_DENORM 4
#define POPFLOAT_VERTEX_CALC_PACKED_GF_PARAM_EN_INF 5
#define POPFLOAT_VERTEX_CALC_PACKED_GF_PARAM_PROP_NAN 6
#define POPFLOAT_VERTEX_CALC_PACKED_GF_PARAM_RMODE 7
#define POPFLOAT_VERTEX_CALC_PACKED_GF_PARAM_SR_BITS 8

/*!
  VBASE POINTER OFFSETS
 */
#define POPFLOAT_VBASE_GFLOAT_STRUCT_PTR_OFFSET 0
#define POPFLOAT_VBASE_CALC_GFLOAT_PARAM_PTR_OFFSET 1

#define POPFLOAT_VBASE_CAST_GFLOAT_PARAM_PTR_OFFSET 0
#define POPFLOAT_VBASE_CAST_INPUT_BASE_PTR_OFFSET 1
#define POPFLOAT_VBASE_CAST_OUTPUT_BASE_PTR_OFFSET 2
#if defined(VECTOR_AVAIL_SCALED_PTR64)
#define POPFLOAT_VBASE_CAST_INPLACE_ELEMENTS_PER_WORKER_OFFSET 2
#define POPFLOAT_VBASE_CAST_INPLACE_LAST_WORKER_PARAM_OFFSET 3
#define POPFLOAT_VBASE_CAST_INPLACE_ROUNDING_PARAM_OFFSET 4
#define POPFLOAT_VBASE_CAST_ELEMENTS_PER_WORKER_OFFSET 3
#define POPFLOAT_VBASE_CAST_LAST_WORKER_PARAM_OFFSET 4
#define POPFLOAT_VBASE_CAST_ROUNDING_PARAM_OFFSET 5
#else
#define POPFLOAT_VBASE_CAST_INPLACE_ELEMENTS_PER_WORKER_OFFSET 4
#define POPFLOAT_VBASE_CAST_INPLACE_LAST_WORKER_PARAM_OFFSET 5
#define POPFLOAT_VBASE_CAST_INPLACE_ROUNDING_PARAM_OFFSET 3
#define POPFLOAT_VBASE_CAST_ELEMENTS_PER_WORKER_OFFSET 6
#define POPFLOAT_VBASE_CAST_LAST_WORKER_PARAM_OFFSET 7
#define POPFLOAT_VBASE_CAST_ROUNDING_PARAM_OFFSET 4
#endif

/*!
  CAST PARAMETERS USED BY NATIVE TO GFLOAT CODELETS
 */
#define POPFLOAT_CAST_PARAMS_SR_MASK_OFFSET 0
#define POPFLOAT_CAST_PARAMS_FP32_SCALE_IN_OFFSET 2
#define POPFLOAT_CAST_PARAMS_FP32_SCALE_OUT_OFFSET 4
#define POPFLOAT_CAST_PARAMS_FP32_CLAMP_OUT_OFFSET 6
#define POPFLOAT_CAST_PARAMS_FP32_DENSITY_PARAM_OFFSET 8
#define POPFLOAT_CAST_PARAMS_FP16_SCALE_IN_OFFSET 2
#define POPFLOAT_CAST_PARAMS_FP16_SCALE_OUT_OFFSET 3
#define POPFLOAT_CAST_PARAMS_FP16_CLAMP_OUT_OFFSET 4
#define POPFLOAT_CAST_PARAMS_FP16_DENSITY_PARAM_OFFSET 5

#define POPFLOAT_ROUND_PARAMS_TOTAL_SIZE 2
#define POPFLOAT_SR_ROUND_PARAMS_FP32_TOTAL_SIZE 9
#define POPFLOAT_SR_ROUND_PARAMS_FP16_TOTAL_SIZE 6

/*!
  CAST TO GFLOAT16
 */
// Scratch: 32 bytes
#define POPFLOAT_CAST_TO_GF16_STACK_OUTPUT_OFFSET 0
#define POPFLOAT_CAST_TO_GF16_STACK_CONST_ONE_OFFSET 0
#define POPFLOAT_CAST_TO_GF16_STACK_TRUNCATED_NORM_OFFSET 0
#define POPFLOAT_CAST_TO_GF16_STACK_GF8_EXP_MASK_OFFSET 0
#define POPFLOAT_CAST_TO_GF16_STACK_GF8_INPUT_OFFSET 0
#define POPFLOAT_CAST_TO_GF16_STACK_OUT_BITMASK_OFFSET 2
#define POPFLOAT_CAST_TO_GF16_STACK_GF8_SIGN_MASK_OFFSET 2
#define POPFLOAT_CAST_TO_GF16_STACK_GF8_IN_BASE_PTR_OFFSET 2
#define POPFLOAT_CAST_TO_GP16_STACK_GF8_OUT_BASE_PTR_OFFSET 3
#define POPFLOAT_CAST_TO_GF16_STACK_EXPONENT_OFFSET 4
#define POPFLOAT_CAST_TO_GF16_STACK_GF8_MAX_EXP_OFFSET 4
#define POPFLOAT_CAST_TO_GF16_STACK_SR_MASK_OFFSET 6
#define POPFLOAT_CAST_TO_GF16_STACK_HALF_MIN_OFFSET 6
#define POPFLOAT_CAST_TO_GF16_STACK_GF8_SCALED_IN_OFFSET 6
#define POPFLOAT_CAST_TO_GF16_TOTAL_STACK_SIZE 8

// GF16 Parameters
#define POPFLOAT_CAST_TO_GF16_PARAM_EXPONENT_MASK_OFFSET 0
#define POPFLOAT_CAST_TO_GF16_PARAM_SIGN_MASK_OFFSET 2
#define POPFLOAT_CAST_TO_GF16_PARAM_QNAN_OUTPUT_OFFSET 4
#define POPFLOAT_CAST_TO_GF16_PARAM_NORM_MAN_MASK_OFFSET 6
#define POPFLOAT_CAST_TO_GF16_PARAM_MIN_DNRM_OFFSET 8
#define POPFLOAT_CAST_TO_GF16_PARAM_CLAMP_FP32_IN_OFFSET 10
#define POPFLOAT_CAST_TO_GF16_PARAM_SCALE_INPUT_OFFSET 12
#define POPFLOAT_CAST_TO_GF16_PARAM_SCALE_IN_RECIP_OFFSET 14
#define POPFLOAT_CAST_TO_GF16_PARAM_PACK_BITS_MASK_OFFSET 16
#define POPFLOAT_CAST_TO_GF16_PARAM_MAX_EXPONENT_OFFSET 18
#define POPFLOAT_CAST_TO_GF16_PARAM_CLAMP_FP16_IN_OFFSET 20
#define POPFLOAT_CAST_TO_GF16_PARAM_CLAMP_OUTPUT_OFFSET 21
#define POPFLOAT_CAST_TO_GF16_PARAM_MIN_OUTPUT_OFFSET 22
#define POPFLOAT_CAST_TO_GF16_PARAM_POWER2_M_MAN_10_OFFSET 23
#define POPFLOAT_CAST_TO_GF16_PARAM_POWER2_M1_OFFSET 24
#define POPFLOAT_CAST_TO_GF16_PARAM_POWER2_10_OFFSET 25
#define POPFLOAT_CAST_TO_GF16_PARAM_PACK_SHR_ALIGN_OFFSET 26
#define POPFLOAT_CAST_TO_GF16_PARAM_UNPACK_SHR_ALIGN_OFFSET 27
#define POPFLOAT_CAST_TO_GP16_PARAM_GF8_SIGN_MASK_OFFSET 28
#define POPFLOAT_CAST_TO_GF16_TOTAL_PARAM_SIZE 29

/*!
  CAST TO GFLOAT32
 */
// Scratch 32 bytes
#define POPFLOAT_CAST_TO_GF32_STACK_CORRECTION_OFFSET 0
#define POPFLOAT_CAST_TO_GF32_STACK_MAN_LSB_OFFSET 0
#define POPFLOAT_CAST_TO_GF32_STACK_HALFMIN_MASK_OFFSET 0
#define POPFLOAT_CAST_TO_GF32_STACK_UNPACK_INPUT_OFFSET 0
#define POPFLOAT_CAST_TO_GF32_STACK_GF8_SHUF8_OFFSET 0
#define POPFLOAT_CAST_TO_GF32_STACK_OUT_BITMASK_OFFSET 2
#define POPFLOAT_CAST_TO_GF32_STACK_IN_BASE_PTR_OFFSET 2
#define POPFLOAT_CAST_TO_GF32_STACK_OUT_BASE_PTR_OFFSET 3
#define POPFLOAT_CAST_TO_GF32_STACK_GF16_SIGN_OFFSET 4
#define POPFLOAT_CAST_TO_GF32_STACK_TRUNCATED_NORM_OFFSET 4
#define POPFLOAT_CAST_TO_GF32_STACK_SR_MASK_OFFSET 6
#define POPFLOAT_CAST_TO_GF32_STACK_TIE_MASK_OFFSET 6
#define POPFLOAT_CAST_TO_GF32_TOTAL_STACK_SIZE 8

// GF32 Parameters
#define POPFLOAT_CAST_TO_GF32_PARAM_NORM_MANT_MASK_OFFSET 0
#define POPFLOAT_CAST_TO_GF32_PARAM_EXPONENT_MASK_OFFSET 2
#define POPFLOAT_CAST_TO_GF32_PARAM_SIGN_MASK_OFFSET 4
#define POPFLOAT_CAST_TO_GF32_PARAM_QNAN_MASK_OFFSET 6
#define POPFLOAT_CAST_TO_GF32_PARAM_SIGN_EXP_MASK_OFFSET 8
#define POPFLOAT_CAST_TO_GF32_PARAM_BIT23_MASK_OFFSET 10
#define POPFLOAT_CAST_TO_GF32_PARAM_CLAMP_OUTPUT_OFFSET 12
#define POPFLOAT_CAST_TO_GF32_PARAM_HALF_MIN_OFFSET 14
#define POPFLOAT_CAST_TO_GF32_PARAM_PACK_BITS_MASK_OFFSET 16
#define POPFLOAT_CAST_TO_GF32_PARAM_MIN_NORM_OFFSET 18
#define POPFLOAT_CAST_TO_GF32_PARAM_GF16_EXP_MASK_OFFSET 20
#define POPFLOAT_CAST_TO_GF32_PARAM_MIN_VALUE_OFFSET 22
#define POPFLOAT_CAST_TO_GF32_PARAM_EN_DENORM_OFFSET 23
#define POPFLOAT_CAST_TO_GF32_PARAM_PACK_EXP_ALIGN_OFFSET 24
#define POPFLOAT_CAST_TO_GF32_PARAM_PACK_SHR_ALIGN_OFFSET 25
#define POPFLOAT_CAST_TO_GF32_PARAM_UNPACK_EXP_ALIGN_OFFSET 26
#define POPFLOAT_CAST_TO_GF32_PARAM_UNPACK_SHIFT0_OFFSET 27
#define POPFLOAT_CAST_TO_GF32_PARAM_UNPACK_SHIFT1_OFFSET 28
#define POPFLOAT_CAST_TO_GF32_TOTAL_PARAM_SIZE 29

#define POPFLOAT_IPU_CLAMP_INDEX_MAX 0
#define POPFLOAT_IPU_CLAMP_INDEX_MIN 1

/*!
  PACKED GFLOAT STRUCTURE 4 bytes:
  [MANTISSA (8)]
  [EXPONENT (8)]
  [BIAS(8)]
  [|ENINF(1)|ENDNRM(1)]
 */
#define POPFLOAT_GF_STRUCT_MANTISSA_SIZE_OFFSET 0
#define POPFLOAT_GF_STRUCT_EXPONENT_SIZE_OFFSET 1
#define POPFLOAT_GF_STRUCT_EXP_BIAS_OFFSET 2
#define POPFLOAT_GF_STRUCT_PARAMS_OFFSET 3
#define POPFLOAT_GF_STRUCT_ENDENORM_BIT_OFFSET 0
#define POPFLOAT_GF_STRUCT_ENINF_BIT_OFFSET 1
#define POPFLOAT_GF_STRUCT_ALL_MAN_ZERO_BIT_OFFSET 2
#define POPFLOAT_GF_STRUCT_ALL_MAN_INF_BIT_OFFSET 3
#define POPFLOAT_GF_STRUCT_ENDENORM_MASK                                       \
  (1 << POPFLOAT_GF_STRUCT_ENDENORM_BIT_OFFSET)
#define POPFLOAT_GF_STRUCT_ENINF_MASK (1 << POPFLOAT_GF_STRUCT_ENINF_BIT_OFFSET)
#define POPFLOAT_GF_STRUCT_ALL_MAN_ZERO_MASK                                   \
  (1 << POPFLOAT_GF_STRUCT_ALL_MAN_ZERO_BIT_OFFSET)
#define POPFLOAT_GF_STRUCT_ALL_MAN_INF_MASK                                    \
  (1 << POPFLOAT_GF_STRUCT_ALL_MAN_INF_BIT_OFFSET)

#define POPFLOAT_BIT_MASK(BITS) ((1 << BITS) - 1)
#define POPFLOAT_MAN_MASK(MAN) (POPFLOAT_BIT_MASK(MAN))
#define POPFLOAT_EXP_MASK(EXP, MAN) (POPFLOAT_BIT_MASK(EXP) << MAN)
#define POPFLOAT_SGN_MASK(EXP, MAN) (1 << (EXP + MAN))

#define POPFLOAT_FP8_SIGN_MASK (1 << 7)
#define POPFLOAT_FP8_V2_SIGN_MASK                                              \
  (POPFLOAT_FP8_SIGN_MASK | (POPFLOAT_FP8_SIGN_MASK << 8))
#define POPFLOAT_FP8_V4_SIGN_MASK                                              \
  (POPFLOAT_FP8_V2_SIGN_MASK | (POPFLOAT_FP8_V2_SIGN_MASK << 16))

#define POPFLOAT_NUM_FP16_MANTISSA_BITS (10)
#define POPFLOAT_NUM_FP16_EXPONENT_BITS (5)
#define POPFLOAT_FP16_EXPONENT_BIAS (15)
#define POPFLOAT_FP16_MANTISSA_MASK                                            \
  POPFLOAT_MAN_MASK(POPFLOAT_NUM_FP16_MANTISSA_BITS)
#define POPFLOAT_FP16_EXPONENT_MASK                                            \
  POPFLOAT_EXP_MASK(POPFLOAT_NUM_FP16_EXPONENT_BITS,                           \
                    POPFLOAT_NUM_FP16_MANTISSA_BITS)
#define POPFLOAT_FP16_SIGN_MASK                                                \
  POPFLOAT_SGN_MASK(POPFLOAT_NUM_FP16_EXPONENT_BITS,                           \
                    POPFLOAT_NUM_FP16_MANTISSA_BITS)
#define POPFLOAT_FP16_MAX_EXP POPFLOAT_FP16_EXPONENT_BIAS
#define POPFLOAT_FP16_EXP_MAX_HALF                                             \
  (POPFLOAT_FP16_EXPONENT_BIAS + POPFLOAT_FP16_MAX_EXP)
#define POPFLOAT_FP16_MIN_NORM (1 - POPFLOAT_FP16_EXPONENT_BIAS)
#define POPFLOAT_FP16_MIN_DENORM                                               \
  (POPFLOAT_FP16_MIN_NORM - POPFLOAT_NUM_FP16_MANTISSA_BITS)
#define POPFLOAT_FP16_GEN_QNAN 0x7C9C

#define POPFLOAT_FP16_EXPONENT_SHIFT POPFLOAT_NUM_FP16_MANTISSA_BITS
#define POPFLOAT_FP16_INFINITY_MASK                                            \
  (POPFLOAT_BIT_MASK(POPFLOAT_NUM_FP16_EXPONENT_BITS))
#define POPFLOAT_FP16_SIGN_SHIFT                                               \
  (POPFLOAT_FP16_EXPONENT_SHIFT + POPFLOAT_NUM_FP16_EXPONENT_BITS)
#define POPFLOAT_FP16_Q_SHIFT (POPFLOAT_FP16_EXPONENT_SHIFT - 1)
#define POPFLOAT_FP16_EXPONENT(v)                                              \
  (((v)&POPFLOAT_FP16_EXPONENT_MASK) >> POPFLOAT_FP16_EXPONENT_SHIFT)
#define POPFLOAT_FP16_MANTISSA(v) ((v)&POPFLOAT_FP16_MANTISSA_MASK)
#define POPFLOAT_FP16_SIGN(v) (((v) >> POPFLOAT_FP16_SIGN_SHIFT) & 1)
#define POPFLOAT_FP16_IS_NEG(v) (POPFLOAT_FP16_SIGN(v) != 0)
#define POPFLOAT_FP16_IS_ZERO(v)                                               \
  ((POPFLOAT_FP16_EXPONENT(v) == 0) && (POPFLOAT_FP16_MANTISSA(v) == 0))
#define POPFLOAT_FP16_IS_SUBNORM(v)                                            \
  ((POPFLOAT_FP16_EXPONENT(v) == 0) && (POPFLOAT_FP16_MANTISSA(v) != 0))
#define POPFLOAT_FP16_IS_INFINITY(v)                                           \
  ((POPFLOAT_FP16_EXPONENT(v) == POPFLOAT_FP16_INFINITY_MASK) &&               \
   (POPFLOAT_FP16_MANTISSA(v) == 0))
#define POPFLOAT_FP16_IS_NAN(v)                                                \
  ((POPFLOAT_FP16_EXPONENT(v) == POPFLOAT_FP16_INFINITY_MASK) &&               \
   (POPFLOAT_FP16_MANTISSA(v) != 0))
#define POPFLOAT_FP16_IS_QNAN(v)                                               \
  (POPFLOAT_FP16_IS_NAN(v) && (((v >> POPFLOAT_FP16_Q_SHIFT) & 1) == 1))
#define POPFLOAT_FP16_IS_SNAN(v)                                               \
  (POPFLOAT_FP16_IS_NAN(v) && (((v >> POPFLOAT_FP16_Q_SHIFT) & 1) == 0))
#define POPFLOAT_FP16_INFINITY                                                 \
  (POPFLOAT_FP16_INFINITY_MASK << POPFLOAT_FP16_EXPONENT_SHIFT)

#define POPFLOAT_NUM_FP32_MANTISSA_BITS (23)
#define POPFLOAT_NUM_FP32_EXPONENT_BITS (8)
#define POPFLOAT_FP32_EXPONENT_BIAS (127)
#define POPFLOAT_FP32_MANTISSA_MASK                                            \
  POPFLOAT_MAN_MASK(POPFLOAT_NUM_FP32_MANTISSA_BITS)
#define POPFLOAT_FP32_EXPONENT_MASK                                            \
  POPFLOAT_EXP_MASK(POPFLOAT_NUM_FP32_EXPONENT_BITS,                           \
                    POPFLOAT_NUM_FP32_MANTISSA_BITS)
#define POPFLOAT_FP32_SIGN_MASK                                                \
  POPFLOAT_SGN_MASK(POPFLOAT_NUM_FP32_EXPONENT_BITS,                           \
                    POPFLOAT_NUM_FP32_MANTISSA_BITS)
#define POPFLOAT_FP32_MAX_EXP POPFLOAT_FP32_EXPONENT_BIAS
#define POPFLOAT_FP32_EXP_MAX_HALF                                             \
  (POPFLOAT_FP32_EXPONENT_BIAS + POPFLOAT_FP16_MAX_EXP)
#define POPFLOAT_FP32_GEN_QNAN 0x7FD9C07E
#define POPFLOAT_FP32_POWER2(N)                                                \
  ((N + POPFLOAT_FP32_EXPONENT_BIAS) << POPFLOAT_NUM_FP32_MANTISSA_BITS)

#define POPFLOAT_FP32_EXPONENT_SHIFT POPFLOAT_NUM_FP32_MANTISSA_BITS
#define POPFLOAT_FP32_INFINITY_MASK                                            \
  (POPFLOAT_BIT_MASK(POPFLOAT_NUM_FP32_EXPONENT_BITS))
#define POPFLOAT_FP32_SIGN_SHIFT                                               \
  (POPFLOAT_FP32_EXPONENT_SHIFT + POPFLOAT_NUM_FP32_EXPONENT_BITS)
#define POPFLOAT_FP32_Q_SHIFT (POPFLOAT_FP32_EXPONENT_SHIFT - 1)
#define POPFLOAT_FP32_EXPONENT(v)                                              \
  (((v)&POPFLOAT_FP32_EXPONENT_MASK) >> POPFLOAT_FP32_EXPONENT_SHIFT)
#define POPFLOAT_FP32_MANTISSA(v) ((v)&POPFLOAT_FP32_MANTISSA_MASK)
#define POPFLOAT_FP32_SIGN(v) (((v) >> POPFLOAT_FP32_SIGN_SHIFT) & 1)
#define POPFLOAT_FP32_IS_NEG(v) (POPFLOAT_FP32_SIGN(v) != 0)
#define POPFLOAT_FP32_IS_ZERO(v)                                               \
  ((POPFLOAT_FP32_EXPONENT(v) == 0) && (POPFLOAT_FP32_MANTISSA(v) == 0))
#define POPFLOAT_FP32_IS_SUBNORM(v)                                            \
  ((POPFLOAT_FP32_EXPONENT(v) == 0) && (POPFLOAT_FP32_MANTISSA(v) != 0))
#define POPFLOAT_FP32_IS_INFINITY(v)                                           \
  ((POPFLOAT_FP32_EXPONENT(v) == POPFLOAT_FP32_INFINITY_MASK) &&               \
   (POPFLOAT_FP32_MANTISSA(v) == 0))
#define POPFLOAT_FP32_IS_NAN(v)                                                \
  ((POPFLOAT_FP32_EXPONENT(v) == POPFLOAT_FP32_INFINITY_MASK) &&               \
   (POPFLOAT_FP32_MANTISSA(v) != 0))
#define POPFLOAT_FP32_IS_QNAN(v)                                               \
  (POPFLOAT_FP32_IS_NAN(v) && ((((v) >> POPFLOAT_FP32_Q_SHIFT) & 1) == 1))
#define POPFLOAT_FP32_IS_SNAN(v)                                               \
  (POPFLOAT_FP32_IS_NAN(v) && ((((v) >> POPFLOAT_FP32_Q_SHIFT) & 1) == 0))
#define POPFLOAT_FP32_INFINITY                                                 \
  (POPFLOAT_FP32_INFINITY_MASK << POPFLOAT_FP32_EXPONENT_SHIFT)

#define POPFLOAT_GF16_VEC_SIZE (4)
#define POPFLOAT_GF32_VEC_SIZE (2)

/*!
 Rounding modes
 */

#define POPFLOAT_ROUND_INVALID (0)
#define POPFLOAT_ROUND_TO_ZERO (1)
#define POPFLOAT_ROUND_TO_NEAREST_EVEN (2)
#define POPFLOAT_ROUND_TO_NEAREST_AWAY (3)
#define POPFLOAT_ROUND_TO_POS_INF (4)
#define POPFLOAT_ROUND_TO_NEG_INF (5)
#define POPFLOAT_ROUND_STOCHASTIC (6)
#define POPFLOAT_ROUND_STOCHASTIC_EXTEND (7)

/*!
 SR noise densities
*/

#define POPFLOAT_SR_DENSITY_INVALID (0)
#define POPFLOAT_SR_DENSITY_UNIFORM (1)
#define POPFLOAT_SR_DENSITY_NORMAL (2)
#define POPFLOAT_SR_DENSITY_TRUNCATED_NORMAL (3)
#define POPFLOAT_SR_DENSITY_BERNOULLI (4)
#define POPFLOAT_SR_DENSITY_LOGISTIC (5)
#define POPFLOAT_SR_DENSITY_TRUNCATED_LOGISTIC (6)
#define POPFLOAT_SR_DENSITY_LAPLACE (7)
#define POPFLOAT_SR_DENSITY_TRUNCATED_LAPLACE (8)
#define POPFLOAT_SR_DENSITY_LOGIT_NORMAL (9)
#define POPFLOAT_SR_DENSITY_TRUNCATED_LOGIT_NORMAL (10)

/*!
 GF16 storage formats
 */
#define POPFLOAT_ENABLE_GF16_CLASS_FP16
#define POPFLOAT_ENABLE_GF16_CLASS_GF8

#define POPFLOAT_GF16_CLASS_FP16 (0)

#ifdef POPFLOAT_ENABLE_GF16_CLASS_GF8
#define POPFLOAT_GF16_CLASS_FP8_1_5_2 (1)
#define POPFLOAT_GF16_CLASS_FP8_MIN_NORM_ALIGN (2)
#define POPFLOAT_GF16_CLASS_FP8_MAX_NORM_ALIGN (3)
#define POPFLOAT_GF16_CLASS_COUNT (4)

#define POPFLOAT_ENABLE_GF16_CLASS_FP8_1_5_2
#define POPFLOAT_ENABLE_GF16_CLASS_FP8_MIN_NORM_ALIGN
#define POPFLOAT_ENABLE_GF16_CLASS_FP8_MAX_NORM_ALIGN
#endif

/*!
 GF32 storage formats
 */
#define POPFLOAT_ENABLE_GF32_CLASS_FP32
#define POPFLOAT_ENABLE_GF32_CLASS_FP16
#define POPFLOAT_ENABLE_GF32_CLASS_GF16

#define POPFLOAT_GF32_CLASS_FP32 (0)
#define POPFLOAT_GF32_CLASS_FP16 (1)

#ifdef POPFLOAT_ENABLE_GF32_CLASS_GF16
#define POPFLOAT_GF32_CLASS_BFLOAT (2)
#define POPFLOAT_GF32_CLASS_GF16_EN_DENORM (3)
#define POPFLOAT_GF32_CLASS_GF16_NO_DENORM (4)
#define POPFLOAT_GF32_CLASS_COUNT (5)

#define POPFLOAT_ENABLE_GF32_CLASS_BFLOAT
#define POPFLOAT_ENABLE_GF32_CLASS_GF16_EN_DENORM
#define POPFLOAT_ENABLE_GF32_CLASS_GF16_NO_DENORM
#endif

#endif
